package com.icode.web.filter;

import org.sitemesh.builder.SiteMeshFilterBuilder;
import org.sitemesh.config.ConfigurableSiteMeshFilter;

/**
 * Created with IntelliJ IDEA.
 * User: ZhongGang
 * Date: 15-1-6
 * Time: 下午10:36
 */
public class SiteMeshFilter extends ConfigurableSiteMeshFilter {
    private static final String FRONTEND_DECORATOR_PAGE = "/WEB-INF/views/decorator/frontendNew.jsp";
    private static final String BACKEND_DECORATOR_PAGE = "/WEB-INF/views/decorator/backend.jsp";
    private static final String EMPTY_DECORATOR_PAGE = "/WEB-INF/views/decorator/empty.jsp";

    @Override
    protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
        //frontend decorator
        builder.addDecoratorPath("/front/*", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/order/**", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/exchange/**", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/reserve/**", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/my_house/show", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/rent/list", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/rent/details/**", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/rent/pay/**", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/faq/front_faq", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/faq/front_list", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/toAssignmnet/details/**", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/toAssignmnet/list", FRONTEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/exchange/confirm_exchange/**", FRONTEND_DECORATOR_PAGE);
//        builder.addDecoratorPath("/houseBaseList*", FRONTEND_DECORATOR_PAGE);
//        builder.addDecoratorPath("/register/form*", FRONTEND_DECORATOR_PAGE);
//        builder.addDecoratorPath("/login*", FRONTEND_DECORATOR_PAGE);
//        builder.addDecoratorPath("/about*", FRONTEND_DECORATOR_PAGE);

        //backend decorator
        builder.addDecoratorPath("/house/*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/order/reFundList", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/welcome", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/admin*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/home/*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/back/about/*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/member/*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/page", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/reserve/back/*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/note*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/sell*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/house_week/**", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/orderback*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/rentback*", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/faq/**", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/assignmentback/**", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/bannerforapp/**", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/back/**", BACKEND_DECORATOR_PAGE);
        builder.addDecoratorPath("/equipemntsupporting/list",BACKEND_DECORATOR_PAGE);

        //empty decorator
        builder.addDecoratorPath("/login/form", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/register/form", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/password/forget/form", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/password/update/from", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/logon", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/android_*", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/front/houseBase/search*", EMPTY_DECORATOR_PAGE);
        builder.addDecoratorPath("/houseType/*", "/WEB-INF/views/decorator/backend.jsp");

        //customer decorator
        builder.addTagRuleBundle(new CustomTagRule());
    }
}
